<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<style type="text/css">
			#d1>div{
				width:50px;
				height:50px;
				margin:5px;
				background-color: red;
				display: inline-block;
				
			}
		</style>
		<script type="text/javascript">
			function addfn(){
				for(var i=0;i<9;i++){
					for(var j=0;j<=i;j++){
						d1.innerHTML+="<div></div>";
					}
					d1.innerHTML+="<br>";
				}
			}
		</script>
	</head>
	<body>
		<input type="button" value="按钮" onclick="addfn()">
		<div id="d1"></div>
	</body>
</html>